package httydgame;

import java.awt.Rectangle;
import java.util.ArrayList;

public class WhisperingDeath extends Enemy {
	public Rectangle rect1 = new Rectangle(0,0,0,0);
	public Rectangle rect2 = new Rectangle(0,0,0,0);
	public Rectangle rect3 = new Rectangle(0,0,0,0);
	private int health = 3; 
	private boolean visible = true;
	private boolean destroyed = false;

	private ArrayList<Projectile> projectiles = new ArrayList<Projectile>();
	
	public WhisperingDeath(int centerX, int centerY, int speedX)
	{
		setCenterX(centerX);
		setCenterY(centerY);
		setSpeedX(speedX);
	}
	
	public void update()
	{
		this.setCenterX(this.getCenterX() + this.getSpeedX()); 
		rect1.setRect(this.getCenterX() - 70, this.getCenterY() - 42, 73, 87);
		rect2.setRect(this.getCenterX() + 3, this.getCenterY() - 21, 69, 51);
		rect3.setRect(this.getCenterX() + 3, this.getCenterY() - 42, 48, 21);
		if (getHealth() <= 0)
		{
			setVisible(false);
			setDestroyed(true);
		}
		
	}
	
	public boolean isDestroyed() {
		return destroyed;
	}

	public void setDestroyed(boolean destroyed) {
		this.destroyed = destroyed;
	}

	public void shoot()
	{
		Projectile p = new Projectile(this.getCenterX() - 60, this.getCenterY(), -7);
		projectiles.add(p);
	}

	public ArrayList<Projectile> getProjectiles() {
		return projectiles;
	}

	public void setProjectiles(ArrayList<Projectile> projectiles) {
		this.projectiles = projectiles;
	}

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}
	
	public int getHealth() {
		return health;
	}

	public void setHealth(int health) {
		this.health = health;
	}
}
